//
//  YLALodaingCell.swift
//  Your Lover AI
//
//  Created by 阿忠 on 2024/7/17.
//

import Foundation
import UIKit

class YLALodaingCell: UITableViewCell {
    
    var clenVc: UIView = {
        let view = UIView()
        view.backgroundColor = .clear
        view.layer.cornerRadius = 10
        view.layer.masksToBounds = true
        return view
    }()
    
    var backVc: UIView = {
        let view = UIView()
        view.backgroundColor = UIColor(hex: "D36AF0")
        view.layer.cornerRadius = 10
        view.layer.masksToBounds = true
        return view
    }()
    
    //头像
    lazy var iconImg: UIImageView = {
        let image = UIImageView(image: UIImage(named: "ceshi"))
        image.layer.cornerRadius = 21.5
        image.layer.masksToBounds = true
        image.contentMode = .scaleAspectFill
        return image
    }()
    
    //时间
    lazy var timeLab: UILabel = {
        let lab = UILabel()
        lab.text = "02 07 18:00"
        lab.textColor = .white
        lab.font = UIFont.systemFont(ofSize: 12)
        lab.textAlignment = .left
        lab.numberOfLines = 0
        return lab
    }()
    
    
    //播放图片
    lazy var playImg: UIImageView = {
        let image = UIImageView(image: UIImage(named: "chat_loading-1"))
        image.contentMode = .scaleAspectFill
        return image
    }()
    
    override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        contentView.backgroundColor = .clear
        contentView.addSubview(clenVc)
        clenVc.addSubview(iconImg)
        clenVc.addSubview(timeLab)
        clenVc.addSubview(backVc)
        backVc.addSubview(playImg)
        initUI()
    }

    
    func initUI()
    {
        
        clenVc.snp.makeConstraints { make in
            make.left.top.right.bottom.equalToSuperview()
            make.height.equalTo(100)
        }
        
        iconImg.snp.makeConstraints { make in
            make.left.equalTo(16)
            make.top.equalTo(25)
            make.width.height.equalTo(43)
        }
        
        timeLab.snp.makeConstraints { make in
            make.left.equalTo(iconImg.snp.right).offset(8.5)
            make.top.equalTo(iconImg)
            make.right.equalToSuperview()
            make.height.equalTo(9.17)
        }
  
        
        backVc.snp.makeConstraints { make in
            make.left.equalTo(iconImg.snp.right).offset(8)
            make.top.equalTo(timeLab.snp.bottom).offset(7)
            make.width.equalTo(70)
            make.height.equalTo(43)
        }
        
   
        
        playImg.snp.makeConstraints { make in
            make.centerX.centerY.equalToSuperview()
            make.width.height.equalTo(18)
        }

        
    }
    
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}


